package com.googlecode.jerato.library;

public class ValueUtility {

	protected ValueUtility(){
	}

	public static boolean isTrue(Object value){
		if(value == null){
			return false;
		}
		if("1".equals(value.toString())){
			return true;
		}
		return Boolean.valueOf(value.toString()).booleanValue();
	}

	public static boolean isEmpty(Object value){
		if(value == null){
			return true;
		}
		if(value.toString().length() == 0){
			return true;
		}
		return false;
	}

	public static boolean equalsString(Object value1, Object value2){
		if(value1 == value2){
			return true;
		}
		if(value1 == null || value2 == null){
			return false;
		}
		if(value1.equals(value2)){
			return true;
		}
		if(value1.toString().equals(value2.toString())){
			return true;
		}
		return false;
	}

	public static String getPathFromClass(String className){
		if(className == null){
			return null;
		}
		return className.replaceAll("\\.", "\\/");
	}

}
